import 'package:flutter/material.dart';
import '../utils/general.dart';
class FFBtn extends StatelessWidget {
  final double width;
  final double height;
  final Color  bgcolor;
  final VoidCallback onPress;
  final Icon icon;
  final bool isBorder;
  final double radius;
  FFBtn({
    this.width = 40, 
    this.height = 40, 
    this.bgcolor,
    this.onPress,
    this.icon,
    this.isBorder = false,
    this.radius = 20
  });

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap:onPress,
      child:Container(
        width:width,
        height:height,
        decoration:BoxDecoration(
          color: bgcolor ?? Colors.transparent,
          borderRadius: BorderRadius.circular(radius),
          border: isBorder ? Border.all(color:Color.fromRGBO(89, 71, 58, 1.0)) : null
        ),
        child: icon,
      )
    );
  }
}

class FFRowBtn extends StatelessWidget {

  final double height;
  final double fontSize;
  final Color bgColor;
  final Color borderColor;
  final EdgeInsets padding;
  final double radius;
  final String title;
  final VoidCallback onPress;
  final double width;
  static const temp = EdgeInsets.all(0);
  FFRowBtn({
    this.height = 44,
    this.fontSize = 16,
    this.width,
    this.bgColor,
    this.borderColor,
    this.padding = temp,
    this.radius = 4.0,
    this.title,
    this.onPress,
  });

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap:onPress,
      child:Container(
        margin: padding,
        height: height,
        width: width != null ? width : screenWidth(context),
        decoration: BoxDecoration(
          color: bgColor == null ? Colors.white : bgColor,
          borderRadius: BorderRadius.circular(radius),
          border: Border.all(color: borderColor == null ? Colors.white : borderColor),
        ),
        child: Center(
          child:Text(
            title,
            style: TextStyle(
              fontSize: fontSize, 
              color: borderColor == null ? Colors.white : borderColor,
              decoration: TextDecoration.none,
            ),
          )
        )
      )
    );
  }
}
